import { EventEmitter } from 'eventemitter3';

// 定义所有事件类型，避免硬编码
export const Events = {
    // 块(车辆)相关事件
    BLOCK_ADDED: 'block:added',
    BLOCK_DELETED: 'block:deleted',
    BLOCK_UPDATED: 'block:updated',
    BLOCK_SELECTED: 'block:selected',

    // 画布相关事件
    CANVAS_REFRESH: 'canvas:refresh',
    CANVAS_CLICKED: 'canvas:clicked',

    // 缩放相关事件
    SCALE_CHANGED: 'scale:changed',

    // 工具相关事件
    TOOL_CHANGED: 'tool:changed',

    // 场景相关事件
    SCENE_LOADED: 'scene:loaded',
    SCENE_SAVED: 'scene:saved',
    SCENE_CLEARED: 'scene:cleared'
};

// 创建并导出事件总线实例
const eventBus = new EventEmitter();
export default eventBus;
